﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace MvcShop.Models
{
    [MetadataType(typeof(UserMetadata))]
    public partial class User
    {
    }

    public class UserMetadata
    {
        //[Required]
        //public int UserId { get; set; }

        [Required(ErrorMessage = "英文名称必填")]
        [StringLength(10, ErrorMessage = "英文名称的长度不能超过10个字符.")]
        public string UserName { get; set; }

        [Required(ErrorMessage = "密码不能为空")]
        [StringLength(18, ErrorMessage = "密码的长度不能超过18个字符.")]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        [Required(ErrorMessage="Email不能为空")]
        [DataType(DataType.EmailAddress,ErrorMessage="请输入正确的Email地址.")]
        public string Email { get; set; }

        public string LastLoginIP { get; set; }

        public DateTime LastLoginTime { get; set; }

        public DateTime LastLogoutTime { get; set; }

        public int LoginTimes { get; set; }
    }
}
